//
//  HomeHeader.m
//  NotepadApp
//
//  Created by yobet on 2018/4/15.
//  Copyright © 2018年 HJ. All rights reserved.
//

#import "HomeHeader.h"
@interface HomeHeader ()

@property (weak, nonatomic) IBOutlet UILabel *incomLabel;
@property (weak, nonatomic) IBOutlet UILabel *spendingLabel;

@end
@implementation HomeHeader

-(instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self = [[NSBundle mainBundle]loadNibNamed:@"HomeHeader" owner:nil options:nil].firstObject;
        self.frame = frame;
    }
    return self;
}
- (IBAction)yearAndMonth:(UIButton *)sender {
    [mNotificationCenter postNotificationName:@"dateNotification" object:nil];
}

- (IBAction)spendingAndIncome:(UIButton *)sender {
    
    switch (sender.tag) {
        case 10:
            [self.spendingView setBackgroundColor:[UIColor whiteColor]];
            self.spending.textColor = HJColor(240, 8, 7);
            self.income.textColor = [UIColor whiteColor];
            self.incomLabel.textColor = [UIColor whiteColor];
            self.spendingLabel.textColor = HJColor(240, 8, 7);
            [self.incomeView setBackgroundColor:[UIColor clearColor]];
            break;
        case 11:
            [self.spendingView setBackgroundColor:[UIColor clearColor]];
            self.spending.textColor = [UIColor whiteColor];
            self.income.textColor = HJColor(240, 8, 7);
            self.incomLabel.textColor =  HJColor(240, 8, 7);
            self.spendingLabel.textColor =[UIColor whiteColor];
            [self.incomeView setBackgroundColor:[UIColor whiteColor]];
            break;
        default:
            break;
    }
    [mNotificationCenter postNotificationName:@"headerNotification" object:nil userInfo:@{@"tag":@(sender.tag)}];
}
- (IBAction)dateBtn:(id)sender {
    [mNotificationCenter postNotificationName:@"keepNotification" object:nil];
}

@end
